﻿#include "Dx2MaterialManager.h"


void Dx2MaterialManager::BuildMaterial()
{
    auto grass = std::make_shared<Material>();
    grass->Name = "grass";
    grass->MatCBIndex = 0;
    grass->DiffuseSrvHeapIndex = 0;
    grass->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
    grass->FresnelR0 = XMFLOAT3(0.01f, 0.01f, 0.01f);
    grass->Roughness = 0.125f;
    
    auto water = std::make_shared<Material>();
    water->Name = "water";
    water->MatCBIndex = 1;
    water->DiffuseSrvHeapIndex = 1;
    water->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 0.5f);
    water->FresnelR0 = XMFLOAT3(0.1f, 0.1f, 0.1f);
    water->Roughness = 0.0f;

    auto wirefence = std::make_shared<Material>();
    wirefence->Name = "wirefence";
    wirefence->MatCBIndex = 2;
    wirefence->DiffuseSrvHeapIndex = 2;
    wirefence->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
    wirefence->FresnelR0 = XMFLOAT3(0.1f, 0.1f, 0.1f);
    wirefence->Roughness = 0.25f;

    auto icemirror = std::make_shared<Material>();
    icemirror->Name = "icemirror";
    icemirror->MatCBIndex = 3;
    icemirror->DiffuseSrvHeapIndex = 3;
    icemirror->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 0.3f);
    icemirror->FresnelR0 = XMFLOAT3(0.1f, 0.1f, 0.1f);
    icemirror->Roughness = 0.5f;

    auto skullMat = std::make_shared<Material>();
    skullMat->Name = "skullMat";
    skullMat->MatCBIndex = 4;
    skullMat->DiffuseSrvHeapIndex = 4;
    skullMat->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
    skullMat->FresnelR0 = XMFLOAT3(0.05f, 0.05f, 0.05f);
    skullMat->Roughness = 0.3f;

    auto treeSprites = std::make_shared<Material>();
    treeSprites->Name = "treeSprites";
    treeSprites->MatCBIndex = 5;
    treeSprites->DiffuseSrvHeapIndex = 5;
    treeSprites->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
    treeSprites->FresnelR0 = XMFLOAT3(0.01f, 0.01f, 0.01f);
    treeSprites->Roughness = 0.125f;

    auto tessellation = std::make_shared<Material>();
    tessellation->Name = "tessellation";
    tessellation->MatCBIndex = 6;
    tessellation->DiffuseSrvHeapIndex = 4;
    tessellation->DiffuseAlbedo = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
    tessellation->FresnelR0 = XMFLOAT3(0.1f, 0.1f, 0.1f);
    tessellation->Roughness = 0.5f;
	
    mMaterials["grass"] = std::move(grass);
    mMaterials["water"] = std::move(water);
    mMaterials["wirefence"] = std::move(wirefence);
    mMaterials["icemirror"] = std::move(icemirror);
    mMaterials["skullMat"] = std::move(skullMat);
    mMaterials["treeSprites"] = std::move(treeSprites);
    mMaterials["tessellation"] = std::move(tessellation);
}

